package shortlink.config;

import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import shortlink.common.biz.user.UserContext;

@Configuration
public class OpenFeignConfiguration {

    @Bean
    public RequestInterceptor requestInterceptor(){
        return template->{
            template.header("username", UserContext.getUsername());
            template.header("userId", UserContext.getUserId());
            template.header("realName", UserContext.getRealName());
        };
    }
}
